import java.util.ArrayList;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description: 泛型类的练习 抽奖
 * User: 杨已萱
 * Date: 2023-04-14
 * Time: 11:09
 */
public class Test3<T> {//泛型类
    Random random = new Random();
    private T product;
    ArrayList<T> list = new ArrayList<>();//奖品池
    public void addproduct(T t){//添加奖品
//        addproduct(t);
        list.add(t);//Arraylist 自己的填充方法
    }

    public T getProduct() {//获取奖品 抽奖
        product  = list.get(random.nextInt(list.size()));//? 从奖品池list中获取
        return product;
    }

//    public void setProduct(T product) {
//        this.product = product;
//    }
}
